/**
   Represents a single compilation error
 *
 */
package AuxComp;

import java.io.*;

/**
 * @author José
 *
 */
public class CompilationError {

	public CompilationError(String errorMessage, int lineNumber,
			int columnNumber, String lineWithError) {
		this.errorMessage = errorMessage;
		this.lineNumber = lineNumber;
		this.columnNumber = columnNumber;
		this.lineWithError = lineWithError;
	}

	public void setErrorMessage(String errorMessage) {
		this.errorMessage = errorMessage;
	}
	public String getErrorMessage() {
		return errorMessage;
	}

	public void setLineNumber(int lineNumber) {
		this.lineNumber = lineNumber;
	}

	public int getLineNumber() {
		return lineNumber;
	}

	public void setColumnNumber(int columnNumber) {
		this.columnNumber = columnNumber;
	}

	public int getColumnNumber() {
		return columnNumber;
	}

	public void print(PrintWriter out) {
        out.println("Error at line " + lineNumber + " column " + columnNumber + " : ");
        out.println(lineWithError);
        out.println( errorMessage );
        out.flush();
        if ( out.checkError() )
          System.out.println("Error in signaling an error");
	}

	/**
	 * error message!
	 */
	private String errorMessage;
	/**
	 * line of the code with the error
	 */
	private String lineWithError;
	/**
	 * number and column of the error
	 */
	private int lineNumber, columnNumber;

}
